home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / GraphicViewers / ViewGif2 / Source / DecodeGIF.h < prev    next >
Text File  |  1991-08-14  |  3KB  |  92 lines

  1. /*****************************************************************************/
  2. /* DecodeGIF.h                                     */
  3. /* interface file of DecodeGIF class of ViewGif2 application             */
  4. /* January 1990  Carl F. Sutter                             */
  5. /*****************************************************************************/
  6.  
  7. #import <objc/Object.h>
  8. #import "Animator.h"
  9. #import <appkit/obsoleteBitmap.h>
  10.  
  11. /* some global data types and constants */
  12. #define    BYTE unsigned char
  13. #define    WORD unsigned short
  14. #define    MAXCOLORS  256
  15. #define    RGB         3
  16.  
  17. #define STATUS_OPEN        100
  18. #define STATUS_GLOBAL        101
  19. #define STATUS_BLOCK        102
  20. #define STATUS_IMAGE        103
  21. #define STATUS_DECODING        104
  22. #define STATUS_EXTENSION    105
  23. #define STATUS_DONE        106
  24.  
  25. @interface DecodeGIF:Object
  26.    {
  27.    // outlets
  28.    id    decodePanel;            // decoding status panel
  29.    id    gauge;                // time left gauge
  30.    id    width;                // width display text field
  31.    id    height;                // height...
  32.    id    numColors;            // number of colors...
  33.    id    filename;            // current file name being decoded
  34.    
  35.    // internal instance variables
  36.    id        target;            // object to notify when decoding is done
  37.    SEL         action;            // method to perform for above
  38.    char        szFileName[40];        // name of file currently decoded
  39.    char        szPathName[160];    // full path name of file currently decoded
  40.    Animator    *timer;            // Instance of Animator object
  41.    NXStream    *stream;        // file stream of GIF file data
  42.    
  43.    int        nStatus;        // current decoding status
  44.    int        nWidth;            // current image width
  45.    int        nHeight;        //    "      "   height
  46.    int        nNumColors;        // number of colors in current image
  47.    BYTE        byColorMap[MAXCOLORS * RGB];    // color look up table
  48.    int        nBPP;            // bits per pixel
  49.    BOOL        bInterlaced;        // interlaced or not
  50.    BYTE        *byDataR;        // Red   data array to hold image bytes
  51.    BYTE        *byDataG;        // Green data array to hold image bytes
  52.    BYTE        *byDataB;        // Blue  data array to hold image bytes
  53.    BOOL        bDecoding;        // flag for currently LZW decoding status
  54.    Bitmap    *bmpOut;        // decoded, imaged bitmap result
  55.    }
  56.  
  57. // factory methods
  58. + new;
  59. + new:(id )targ action:(SEL )act; 
  60.  
  61. // outlet initialization methods
  62. - setDecodePanel:anObject;
  63. - setGauge:anObject;
  64. - setWidth:anObject;
  65. - setHeight:anObject;
  66. - setNumColors:anObject;
  67. - setFilename:anObject;
  68.  
  69. // actions
  70. - show:sender;
  71. - setTarget:(id)targ; 
  72. - setAction:(SEL)aSelector; 
  73. - decodeFile:(const char *)fileName;
  74.  
  75. // internal methods
  76. - setup;
  77. - nextStep:sender;
  78. - (BOOL)openFile;
  79. - (BOOL)readGlobalInfo;
  80. - (BOOL)readMap;
  81. - (BOOL)readBlockCode;
  82. - (BOOL)readImageInfo;
  83. - (BOOL)startDecoder;
  84. - (BOOL)finishDecoder:(long)lReturnCode;
  85. - (BOOL)readBytes:(int)nNumBytes data:(void *)buf;
  86. - errorAlert:(char *)szMessage;
  87. - sucessfulDecoding;
  88. - cancelDecoding;
  89.  
  90.  
  91. @end
  92.